
package com.dave.gd.common.util.xml.type;

/**
 * Boolean类型转换
 * 
 *
 * 
 */
public class TypeBoolean implements ITypeConverter {
	/**
	 * 如输入text为true(不区分大小写)则返回Boolean.TRUE否则返回Boolean.FALSE
	 * 
	 */
	@Override
	public Object getValue(String text) {
		try {
			Boolean ret = Boolean.valueOf(text);
			if (ret != null) {
				return ret;
			}
		} catch (Throwable t) {
		}
		return false;
	}

	/**
	 * 若输入value是Boolean.TRUE则返回true否则返回false
	 * 
	 */
	@Override
	public String getText(Object value) {
		if (value == null) {
			return null;
		}
		return value.toString();
	}

}
